Accusoft.PdfXpress7.ActiveX
Create & Delete Bookmarks

Bookmarks can be added to a PDF document or removed from a PDF document using the Bookmark methods. PDF bookmarks are constructed as a linked list, with one root node. The following is an example of a bookmark list structure:

In the above example, Chapter One is a child of Root, Chapter Two is a sibling of Chapter One, and Part I is a child of Chapter One.

Add Bookmarks

Each bookmark node in the list is represented by a BookmarkContext object.

The root BookmarkContext of the PDF document's bookmark list can be retrieved by calling GetBookmarkRoot

A child bookmark can be added to any node in the bookmark list, by calling AddBookmarkChild. After one child has been specified, additional siblings are added by calling AddBookmarkSibling.

VB Example
Copy Code
'This code demonstrates how to add bookmarks
On Error GoTo error
Dim pdfXpress1 As  New PdfXpress
pdfXpress1.Initialize
pdfxpress1.RaiseExceptions = True
Dim document As New PdfDocument
document. SetParentControl pdfXpress1  
document.OpenDocument "C:\test.pdf",""
parent = document.GetBookmarkRoot
parent = document.GetBookmarkChild(parent)
Dim Child As New BookmarkContext
Child = document.CreateBookmark
Child.Title = "bookmark1"
Child.ActionPageNumber = 1
document.AddBookmarkChildEx parent, Child
.
.
.
GoTo finish
error:
MsgBox Err.Description
finish:
Set document = Nothing
pdfxpress1.Terminate
Set pdfxpress1= Nothing

Remove Bookmarks

To remove a bookmark from a PDF document, call the RemoveBookmark method.

VB Example
Copy Code
'This code demonstrates how to remove bookmarks 
On Error GoTo error
Dim pdfXpress1 As  New PdfXpress
pdfXpress1.Initialize
pdfxpress1.RaiseExceptions = True
Dim document As New PdfDocument
document. SetParentControl pdfXpress1
document.OpenDocument "C:\test.pdf",""
parent = document.GetBookmarkRoot
parent = document.GetBookmarkChild(parent)
parent = document.GetBookmarkChild(parent)
document.RemoveBookmark parent
.
.
.
GoTo finish
error:
MsgBox Err.Description
finish:

Set document = Nothing
pdfxpress1.Terminate
Set pdfxpress1= Nothing

 

See Also

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback